<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [1,2,3,4,6];
        var res=[]
        for(let i=0;i<arr.length;i+=2){
            // console.log(i);
            res.push(arr.slice(i,i+1).join())
            console.log('res: ', res);
        }
        console.log(...res);
        console.log(res.join("-"));
    </script>
</body>
</html>